package com.xyx.ssm.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xyx.ssm.dao.SyUserMapper;
import com.xyx.ssm.dao.UserMapper;
import com.xyx.ssm.jdbcdao.SyuserDao;
import com.xyx.ssm.po.Syuser;
import com.xyx.ssm.po.Syuserrole;
import com.xyx.ssm.service.SyuserService;
import com.xyx.ssm.util.Page;

@Service
public class SyuserServiceImpl implements SyuserService {

	@Autowired
	private UserMapper userMapper;
	@Autowired
	private SyuserDao syuserDao;
	@Autowired
	private SyUserMapper syusermapper;


	public Page<Map<String, Object>> findPage(Page<Map<String, Object>> page) {
		// TODO Auto-generated method stub
		return syuserDao.findPage(
				"com.xyx.ssm.jdbcdao.syuserDao.SelectAllpage", page);
	}

	public int syuseradd(Syuser syuser) {
		return syuserDao.syuseradd(syuser);
	}

	@Override
	public int syuserDelete(String ids) {
		int n = 0;
		String[] s = ids.split(",");
		for (int i = 0; i < s.length; i++) {
			Integer id = Integer.parseInt(s[i]);
			n = syuserDao.syuserDelete(id);
		}
		return n;
	}

	@Override
	public int syuserUpdate(Syuser syuser) {
		// TODO Auto-generated method stub
		return syuserDao.syuserUpdate(syuser);
	}

	@Override
	public List<Syuser> syuserId(Integer id) {
		// TODO Auto-generated method stub
		return syuserDao.syuserId(id);
	}
	
	@Override
	public int insertuserrole(Syuserrole ur) {
		// TODO Auto-generated method stub
		return syuserDao.insertuserrole(ur);
	}

	@Override
	public List<Syuserrole> login1(Syuser user) {
		// TODO Auto-generated method stub
		return syusermapper.login1(user);
	}

	@Override
	public List<Integer> login3(Integer a) {
		// TODO Auto-generated method stub
		return syusermapper.login3(a);
	}

	@Override
	public Map<String, Object> login4(Integer a) {
		// TODO Auto-generated method stub
		return syusermapper.login4(a);
	}

}
